package com.leoman.dao;

import com.leoman.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * UserDao
 * Created by 涂奕恒 on 2016/11/23 0023 下午 3:45.
 */
public interface UserDao extends JpaRepository<User, Integer>, JpaSpecificationExecutor<User> {

    @Query("select a from User a where a.mobile = ?1")
    User findOneByMobile(String mobile);

    @Query("select a from User a where a.createTime >= ?1 and a.createTime <= ?2")
    List<User> findListByParams(Long startTime, Long endTime);
}